express = require 'express'
router = express.Router()

router.get '/', (req, res) ->
  res.render 'demo/index'

router.post '/', (req, res, next) ->
  req.api.v4.get {
    action: 'product.course.combo.list'
  }
  .then (data) ->
    if not data.status
      return M.Promise.reject new M.errors.TipsError data.msg
    res.json {status: true, data: data.data}
  .catch next
  
module.exports = router